Skip to content

Conversation

ayetealab
Copy link

@ayetealab ayetealab commented Oct 1, 2025

Summary

Propagate Namespace Metadata on Creation

This PR introduces optional propagation of namespace metadata (labels and annotations) from KCP workspaces into destination workload clusters during namespace creation.

  • Default behavior remains unchanged — namespaces are still created in a "one-and-done" manner with no metadata, unless the APIExport and APIBinding explicitly expose and grant permission claims for namespaces.
  • When permitted, the sync-agent will copy labels and annotations from the source namespace into the destination namespace at creation time.
  • No ongoing sync of namespace metadata is introduced - namespaces are not promoted to first-class sync targets.

What Type of PR Is This?

/kind feature

Related Issue(s)

Fixes #97

Release Notes

NONE

@kcp-ci-bot kcp-ci-bot added release-note-none Denotes a PR that doesn't merit a release note. kind/feature Categorizes issue or PR as related to a new feature. labels Oct 1, 2025
@kcp-ci-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign embik for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kcp-ci-bot kcp-ci-bot added dco-signoff: no Indicates the PR's author has not signed the DCO. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Oct 1, 2025
@kcp-ci-bot
Copy link
Contributor

Hi @ayetealab. Thanks for your PR.

I'm waiting for a kcp-dev member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@kcp-ci-bot kcp-ci-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 1, 2025
…n environment

Signed-off-by: Brian Philip <brian.b.philip@shell.com>
@ayetealab ayetealab force-pushed the feature/add-namespace-metadata branch from 7b18943 to 39d0a51 Compare October 2, 2025 07:19
@kcp-ci-bot kcp-ci-bot added dco-signoff: yes Indicates the PR's author has signed the DCO. and removed dco-signoff: no Indicates the PR's author has not signed the DCO. labels Oct 2, 2025
@xrstf
Copy link
Contributor

xrstf commented Oct 6, 2025

Hey there, thanks for your contribution.

I think the added logging is a bit excessive, maybe a leftover from your development efforts?

More importantly though I am worried about the semantics behind this. It's very easy for the sync agent to be configured to merge objects from many namespaces into a single namespace, and at that point it becomes basically random which workspace/namespace's labels/annotations you copy to the destination. Even worse: By doing this, endusers could, in kcp, set nasty labels and annotations that could interfere with for example policy frameworks like Kyverno on the service provider side (just imagine an enduser setting an imaginary kyverno.io/prevent-deletion annotation and suddenly processes on the service cluster would stop working as expected).

I can see how this can be useful in some circumstances, but I would not make this the default behaviour. Instead I would add a new option to PublishedResources, maybe spec.namespace.metadata.copy (bool) to allow admins to opt-in to this behaviour only if and when they know that their mutation rules will work properly here (i.e. no 2 namespaces are merged together).

@embik
Copy link
Member

embik commented Oct 6, 2025

I concur with what @xrstf said, this needs to be an optional feature as its potentially problematic and it should require explicit configuration. Since api-syncagent handles permission claims in the target APIExport, it would be good to have a flag (as suggested above) and then let api-syncagent also create a permission claim for namespaces. A namespace permission claim being the "flag" to toggle this feature is a bit out of place with other optional features.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dco-signoff: yes Indicates the PR's author has signed the DCO. kind/feature Categorizes issue or PR as related to a new feature. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feature: Support optional propagation of Namespace labels/annotations from KCP workspaces to destination clusters
4 participants